<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--
   事件监听  添加事件监听器
-->

<button>事件绑定</button>

<script>

    let btn = document.querySelector('button')

    //  相同事件会有覆盖效果
    /*
     btn.onclick = function (){
        console.log('click1')
    }
    *
     btn.onclick = function (){
        console.log('click2')
    }
    *
    * */

    // 通过事件监听绑定事件 事件会叠加
    btn.addEventListener('click', function () {
        console.log('click1')
    })

    btn.addEventListener('click', function () {
        console.log('click2')
    })

</script>
</body>
</html>
